package com.yunpeng.dishes.dao.model.relation;

import com.yunpeng.dishes.dao.model.RelationDO;

import java.util.Date;

/**
 * OrderDishesNutrientsDO 订单维度营养元素快照
 *
 * @author : Moore(hemw)
 * @date : 2020-03-26
 */
public class OrderDishesNutrientsDO extends RelationDO {

    /**
     * 订单id
     */
    private Long orderId;
    /**
     * 订单编号
     */
    private String orderCode;
    /**
     * 菜品快照
     * {"dishes":[{"name":"麻婆豆腐","code":"001","foods":[{"name":"豆腐","code":"001"}],"nutrients":[{"name":"钾","code":"K","netContent":0.1,"unit":"毫克（mg）"}]},{}],"nutrients":[{"name":"钾","code":"K","netContent":0.1,"unit":"毫克（mg）"}]}
     */
    private String dishesSnapshots;
    /**
     * 快照版本
     * 同订单递增，默认为0，因为目前没有快照编辑功能，所以基本不会变
     */
    private Short version;

    /**
     * 商户
     */
    private Long merchantId;

    /**
     * 用餐时段
     * 1、早餐;2、午餐;3、晚餐;4、夜宵
     */
    private Short mealType;

    public OrderDishesNutrientsDO() {
    }

    public OrderDishesNutrientsDO(Long id, Short flag, Long creator, Date createTime, Long updater, Date updateTime, Long orderId, String orderCode, String dishesSnapshots, Short version, Long merchantId, Short mealType, Long consumer) {
        super(id, flag, creator, createTime, updater, updateTime);
        this.orderId = orderId;
        this.orderCode = orderCode;
        this.dishesSnapshots = dishesSnapshots;
        this.version = version;
        this.merchantId = merchantId;
        this.mealType = mealType;
        this.consumer = consumer;
    }

    /**
     * 消费者
     */
    private Long consumer;

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public String getOrderCode() {
        return orderCode;
    }

    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }

    public String getDishesSnapshots() {
        return dishesSnapshots;
    }

    public void setDishesSnapshots(String dishesSnapshots) {
        this.dishesSnapshots = dishesSnapshots;
    }

    public Short getVersion() {
        return version;
    }

    public void setVersion(Short version) {
        this.version = version;
    }

    public Long getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(Long merchantId) {
        this.merchantId = merchantId;
    }

    public Long getConsumer() {
        return consumer;
    }

    public void setConsumer(Long consumer) {
        this.consumer = consumer;
    }

    public Short getMealType() {
        if (mealType == null) {
            mealType = 0;
        }
        return mealType;
    }

    public void setMealType(Short mealType) {
        this.mealType = mealType;
    }

    @Override
    public String toString() {
        return "OrderDishesNutrientsDO{" +
                "id=" + id +
                ", orderId=" + orderId +
                ", orderCode='" + orderCode + '\'' +
                ", dishesSnapshots='" + dishesSnapshots + '\'' +
                ", version=" + version +
                ", merchantId=" + merchantId +
                ", consumer=" + consumer +
                ", mealType=" + mealType +
                ", flag=" + flag +
                ", creator=" + creator +
                ", createTime=" + createTime +
                ", updater=" + updater +
                ", updateTime=" + updateTime +
                "} ";
    }
}
